app.controller('DetailbreakruleslistCtrl',function ($scope,$http,$localStorage,$location,$window,$state) {
	$scope.namedata = $localStorage.cur_user.uname;	 
  $scope.nowtime =  getnowtime();    
     
      $http.post(
        $scope.app.backendurl+"tbl-violation/view-one",
        {    
          'violation_id': $state.params.oid,
          'token':$localStorage.token                  

        }
        ).success(function (data) {
           //console.log(data);
            if(data.code==0&&data.msg=="读取成功"){ 
              $scope.aaData = data.data;            
              // alert(data.msg);
              // $state.go('app.control.electricquantity')               
            }
            if(data.code==1){             
              alert(data.msg)
                    
            }
            if(data.code==20001&&data.msg=='请先登录'){
              $location.path('access.signin');
            }  
        
       
        }).error(function(data){
          console.log(data);
        })

    $scope.handle = function(mm){
      $http.post(
        $scope.app.backendurl+"tbl-violation/handle",
        {    
          'violation_id': $state.params.doid,
          'version':mm,
          'handle_descript':$scope.des,
          'token':$localStorage.token                  

        }
        ).success(function (data) {
           console.log(data);
            if(data.code==0&&data.msg=="处理完成"){                         
              alert(data.msg);
              $state.go('app.order.breakrules')               
            }
            if(data.code==1){             
              alert(data.msg)
                    
            }
            if(data.code==20001&&data.msg=='请先登录'){
              $location.path('access.signin');
            }  
        
       
        }).error(function(data){
          console.log(data);
        })
    }


  

	


	

})
function getnowtime(){
    var getdata = new Date();       
    var year = getdata.getFullYear();
    var day = getdata.getDate();
    var month = getdata.getMonth()+1;
    var hours = getdata.getHours();
    var minutes = getdata.getMinutes();
    var secondes = getdata.getSeconds();
   return getdata = year + "-" + month + "-" + day + " "  + hours + ":" + minutes + ":" + secondes ; 
}